module.exports = function($scope, $state, $stateParams,$resource,  $modalInstance,poolcode, releasecard, canrelease,getcardtasklist){
    $scope.poolcodeinfo = { 
    	'pool_code' : poolcode
    };
    /* 分页
     * ========================================= */
    $scope.maxSize = 5;            //最多显示多少个按钮
    $scope.bigCurrentPage = 1;      //当前页码
    $scope.itemsPerPage = 5;         //每页显示几条

    $scope.canreleasecard = function(){ 
      console.log(333);
    	var para = {
            pageNo:$scope.bigCurrentPage, 
            pageSize:$scope.itemsPerPage,
            type : '1'
        };
        para = angular.extend($scope.poolcodeinfo, para);
      //   getcardtasklist.save(para, function(res){
    	//     console.log(para); 
    	// 	if (res.errcode !== 0) { 
    	// 		alert(res.errmsg);
    	// 	} else { 
    	// 		$scope.releasecardinfo = res.data.results;
    	// 		 $scope.bigTotalItems = res.data.totalRecord;
    	// 		console.log(res);
    	// 	}
      // });
      console.log(444);
      $resource('/api/as/cdc/cardpooldao/getcardactivetasksList', {}, {}).get(para, function(res){
        if(res.errcode === 0){
          $scope.releasecardinfo = res.data.results;
          // 		 $scope.bigTotalItems = res.data.totalRecord;
          // 		console.log(res);
        }else{
          alert(res.errmsg);
        }
    });
    };
    $scope.canreleasecard();
    
    $scope.cardinfo = {
    	'start_card_num' : '',
      'end_card_num' : '',
      'count' : '',
      'pool_code' : poolcode
    };

    $scope.ok = function () {
        
      $resource('/api/ac/cdc/cardpoolserviceimpl/saveAutoActiveCardTask', {}, {}).get($scope.cardinfo, function(res){
        if(res.errcode === 0){
          alert('添加自动激活成功');
          $scope.canreleasecard();
        }else{
          alert(res.errmsg);
        }
    });


	   
	};  
    

    $scope.cancel = function () {
      $modalInstance.dismiss('cancel');
    };

};